Optimal. Leaf size=59 \[ \frac {x}{b}-\frac {2 a \tan ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{b d \sqrt {a-b} \sqrt {a+b}} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.06, antiderivative size = 59, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.158, Rules used = {2735, 2659, 205} \[ \frac {x}{b}-\frac {2 a \tan ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{b d \sqrt {a-b} \sqrt {a+b}} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 205
Rule 2659
Rule 2735
Rubi steps
\begin {align*} \int \frac {\cos (c+d x)}{a+b \cos (c+d x)} \, dx &=\frac {x}{b}-\frac {a \int \frac {1}{a+b \cos (c+d x)} \, dx}{b}\\ &=\frac {x}{b}-\frac {(2 a) \operatorname {Subst}\left (\int \frac {1}{a+b+(a-b) x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{b d}\\ &=\frac {x}{b}-\frac {2 a \tan ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{\sqrt {a-b} b \sqrt {a+b} d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.09, size = 58, normalized size = 0.98 \[ \frac {\frac {2 a \tanh ^{-1}\left (\frac {(a-b) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {b^2-a^2}}\right )}{\sqrt {b^2-a^2}}+c+d x}{b d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 1.23, size = 223, normalized size = 3.78 \[ \left [\frac {2 \, {\left (a^{2} - b^{2}\right )} d x - \sqrt {-a^{2} + b^{2}} a \log \left (\frac {2 \, a b \cos \left (d x + c\right ) + {\left (2 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, \sqrt {-a^{2} + b^{2}} {\left (a \cos \left (d x + c\right ) + b\right )} \sin \left (d x + c\right ) - a^{2} + 2 \, b^{2}}{b^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + a^{2}}\right )}{2 \, {\left (a^{2} b - b^{3}\right )} d}, \frac {{\left (a^{2} - b^{2}\right )} d x - \sqrt {a^{2} - b^{2}} a \arctan \left (-\frac {a \cos \left (d x + c\right ) + b}{\sqrt {a^{2} - b^{2}} \sin \left (d x + c\right )}\right )}{{\left (a^{2} b - b^{3}\right )} d}\right ] \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [B] time = 0.55, size = 240, normalized size = 4.07 \[ -\frac {\frac {{\left (\sqrt {a^{2} - b^{2}} {\left (2 \, a - b\right )} {\left | a - b \right |} + \sqrt {a^{2} - b^{2}} {\left | a - b \right |} {\left | b \right |}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor + \arctan \left (\frac {2 \, \sqrt {\frac {1}{2}} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {\frac {2 \, a + \sqrt {-4 \, {\left (a + b\right )} {\left (a - b\right )} + 4 \, a^{2}}}{a - b}}}\right )\right )}}{{\left (a^{2} - 2 \, a b + b^{2}\right )} b^{2} + {\left (a^{3} - 2 \, a^{2} b + a b^{2}\right )} {\left | b \right |}} + \frac {{\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor + \arctan \left (\frac {2 \, \sqrt {\frac {1}{2}} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {\frac {2 \, a - \sqrt {-4 \, {\left (a + b\right )} {\left (a - b\right )} + 4 \, a^{2}}}{a - b}}}\right )\right )} {\left (2 \, a - b - {\left | b \right |}\right )}}{b^{2} - a {\left | b \right |}}}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.05, size = 67, normalized size = 1.14 \[ -\frac {2 a \arctan \left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (a -b \right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{d b \sqrt {\left (a -b \right ) \left (a +b \right )}}+\frac {2 \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d b} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: ValueError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 0.78, size = 99, normalized size = 1.68 \[ \frac {2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{b\,d}+\frac {2\,a\,\mathrm {atanh}\left (\frac {a\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )-b\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}}\right )}{b\,d\,\sqrt {b^2-a^2}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 24.70, size = 320, normalized size = 5.42 \[ \begin {cases} \tilde {\infty } x & \text {for}\: a = 0 \wedge b = 0 \wedge d = 0 \\\frac {x}{b} - \frac {\tan {\left (\frac {c}{2} + \frac {d x}{2} \right )}}{b d} & \text {for}\: a = b \\\frac {x}{b} + \frac {1}{b d \tan {\left (\frac {c}{2} + \frac {d x}{2} \right )}} & \text {for}\: a = - b \\\frac {\sin {\left (c + d x \right )}}{a d} & \text {for}\: b = 0 \\\frac {x \cos {\relax (c )}}{a + b \cos {\relax (c )}} & \text {for}\: d = 0 \\\frac {a d x \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}}}{a b d \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}} - b^{2} d \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}}} - \frac {a \log {\left (- \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}} + \tan {\left (\frac {c}{2} + \frac {d x}{2} \right )} \right )}}{a b d \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}} - b^{2} d \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}}} + \frac {a \log {\left (\sqrt {- \frac {a}{a - b} - \frac {b}{a - b}} + \tan {\left (\frac {c}{2} + \frac {d x}{2} \right )} \right )}}{a b d \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}} - b^{2} d \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}}} - \frac {b d x \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}}}{a b d \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}} - b^{2} d \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}}} & \text {otherwise} \end {cases} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________